<?php 
header("content-type:text/html;charset=utf-8");

//使用 mysqli 之 对象风格

//连接数据库
$mysqli = new Mysqli('localhost','root','','test');

if ($mysqli->errno > 0) {
    echo $mysqli->error;
    exit;
}

$mysqli->query('set names utf8');

$sql = "select 'name','age' from user";

$result = $mysqli->query($sql);

//得到对象
$list = $result->fetch_all();

$mysqli->close();

var_dump($list);




